Skip to content

[NFC] Using orderedBefore in skipNonNullCast#8803

Merged
tlively merged 2 commits into
mainfrom
optimize-instructions-order-1584
Jun 5, 2026
Merged

[NFC] Using orderedBefore in skipNonNullCast#8803
tlively merged 2 commits into
mainfrom
optimize-instructions-order-1584

Conversation

@tlively
Copy link
Copy Markdown
Member

@tlively tlively commented Jun 5, 2026

When OptimizeInstructions skips explicit ref.as_non_null instructions because they are flowing into a parent expression that will already do a null check, it has to check that moving the trap effect past any subsequent children of the parent is allowed. Update the code to use orderedBefore instead of invalidates. Also make this change in another place that removes a ref.as_non_null in the same way.

This is not a functional change because traps are ordered symmetrically with other effects; a trap can be moved forward past another effect iff it can be moved backward past that other effect. The code therefore has the same behavior whether it uses orderedBefore, orderedAfter, or invalidates here. orderedBefore makes the most sense given then context, though.

When OptimizeInstructions skips explicit `ref.as_non_null` instructions because they are flowing into a parent expression that will already do a null check, it has to check that moving the trap effect past any subsequent children of the parent is allowed. Update the code to use `orderedBefore` instead of `invalidates`.

This is not a functional change because traps are ordered symmetrically with other effects; a trap can be moved forward past another effect iff it can be moved backward past that other effect. The code therefore has the same behavior whether it uses `orderedBefore`, `orderedAfter`, or `invalidates` here. `orderedBefore` makes the most sense given then context, though.
@tlively tlively requested a review from a team as a code owner June 5, 2026 00:41
@tlively tlively requested review from stevenfontanella and removed request for a team June 5, 2026 00:41
@tlively tlively merged commit a568a14 into main Jun 5, 2026
16 checks passed
@tlively tlively deleted the optimize-instructions-order-1584 branch June 5, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants